home *** CD-ROM | disk | FTP | other *** search
- Q32774 Incorrect Code for Loop with Longs
- C Compiler
- 5.10 | 5.10
- MS-DOS | OS/2
-
- Summary:
- The code generated for the following example is incorrect. The code
- generated for the commented line below is assuming that the variable
- nline is equal to the variable curlin and the code for the statement:
-
- *(lines+nline) = nxtchr++;
-
- is evaluated as:
-
- *(lines+curlin)= nxtchr++;
-
- Microsoft has confirmed this to be a problem in Version 5.10 of the
- C compiler. We are researching this problem and will post new
- information as it becomes available.
-
-
- More information:
- The code to reproduce the problem is as follows:
-
- long nxtchr, *lines;
- int curlin;
- int dummy;
-
- void main() {
- int to;
- int nline;
-
- lines = &dummy;
- nline = curlin;
- curlin = to + 1;
-
- /* loop optimizer acts as though nline still equals curlin */
-
- for ( ; nline < curlin ; ++nline) {
- *(lines+nline) = nxtchr++; /* generates code for *(lines+curlin) */
- }
- printf("nxtchr %d, lines %d, curlin %d, to %d, nline %d\n"
- ,nxtchr,lines,curlin,t o,nline);
- }
-
-
- Keywords: buglist5.10 qfbv
- Updated 88/07/21 03:19
-